<?php
/**
 * Created by PhpStorm.
 * User: MR_THONG
 * Date: 2/16/2015
 * Time: 12:21 AM
 */?>
<?php echo $this->Html->script(array('jquery-1.11.2.min'));?>
<div class="col-xs-12 col-sm-9 col-md-9 col-lg-9 ">


    <?php
        if ($tourDisplay['Tour']['is_national']){
        echo $this->Html->image('skin-tour-02.jpg',array('class'=>'img-responsive'));
    }else{
        echo $this->Html->image('skin-tour-01.jpg',array('class'=>'img-responsive'));
    }?>



    <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12 col-pr-0 col-pt-2">
        <div class="col-xs-4 col-sm-4 col-md-4 col-lg-4 col-pd-0 ">
            <p class="">
                <?php echo $this->Html->image($tourDisplay['Tour']['imageURL'],array('class'=>'img-responsive img-intro')); ?>
            </p>
        </div>
        <div class="col-xs-8 col-sm-8 col-md-8 col-lg-8 col-pr-0">
            <ul class="list-unstyled list-info-intro">
                <li>
                     <span style="color: red; font-size: 25px">
                            <?php echo $tourDisplay['Tour']['title'] ?>
                        </span>
                </li>
                <li>
                    <strong>Ngày khởi hành:</strong>
                                <span>
                                    <?php if ($tourDisplay['Tour']['start_date']){
                                        echo $tourDisplay['Tour']['start_date'];
                                    }else{
                                        echo 'Updating...';
                                    }
                                    ?>
                                </span>
                </li>
                <li>
                    <strong>Thời gian:</strong>
                                <span>
                                    <?php if ($tourDisplay['Tour']['schedule']){
                                        echo $tourDisplay['Tour']['schedule'];
                                    }else{
                                        echo 'Updating...';
                                    }
                                    ?>
                                </span>
                </li>
                <li>
                    <strong>Khách sạn:</strong>
                                <span>
                                   <?php if ($tourDisplay['Tour']['hotel_start']){
                                       echo $tourDisplay['Tour']['hotel_start'].' sao';
                                   }else{
                                       echo 'Updating...';
                                   }
                                   ?>
                                </span>
                </li>
                <li>
                    <strong>Điểm xuất phát:</strong>
                                <span>
                                  <?php if ($tourDisplay['Tour']['start_point']){
                                      echo $tourDisplay['Tour']['start_point'];
                                  }else{
                                      echo 'Updating...';
                                  }
                                  ?>
                                </span>
                </li>
                <li>
                    <strong>Phương tiện:</strong>
                                <span>
                                   <?php if ($tourDisplay['Tour']['vehicle']){
                                       echo $tourDisplay['Tour']['vehicle'];
                                   }else{
                                       echo 'Updating...';
                                   }
                                   ?>
                                </span>
                </li>
                <li>
                    <strong>Giá:</strong>
                                <span class="color-red">
                                  <?php
                                  echo $this->Number->format($tourDisplay['Tour']['price'], array(
                                      'places' => 3,
                                      'before' => ' ',
                                      'escape' => false,
                                      'decimals' => ',',
                                      'thousands' => ','
                                  ));
                                  ?>
                                </span>
                </li>
            </ul>
        </div>
    </div>



    <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12 col-pr-0 col-pt-2">
        <div role="tabpanel">

            <!-- Nav tabs -->
            <ul class="nav nav-tabs" role="tablist">
                <li role="presentation" class="active"><a href="#home" aria-controls="home" role="tab" data-toggle="tab">Lịch Trình Tour</a></li>
                <li role="presentation"><a href="#profile" aria-controls="profile" role="tab" data-toggle="tab">Đặt Tour</a></li>
            </ul>

            <!-- Tab panes -->
            <div class="tab-content">
                <div role="tabpanel" class="tab-pane active" id="home">
                    <div>
                        <?php echo $tourDisplay['Tour']['content']?>
                    </div>
                </div>
                <div role="tabpanel" class="tab-pane" id="profile">

                    <p class="title-TTKH">Thông tin khách hàng</p>

                    <?php echo $this->Form->create('Post', [
                        'url' => ['controller' => 'CustomerTour', 'action' => 'settour']
                    ]); ?>

                    <?php
                    echo $this->Form->input(
                        'tourname',
                        array('label' => 'Tên Tour: ')
                    );
                    ?>

                    <?php
                    echo $this->Form->input(
                        'customername',
                        array('label' => 'Tên của bạn (*):')
                    );
                    ?>
                    <div id = "txtcustomername" class="hidden" style="color: red">Vui long nhap ten</div>
                    <?php
                    echo $this->Form->input(
                        'customeremail',
                        array('label' => 'Địa chỉ Email: ')
                    );
                    ?>
                    <div id = "txtcustomeremail" class="hidden" style="color: red">Email khong hop le</div>
                    <?php
                    echo $this->Form->input(
                        'customerphone',
                        array('label' => 'Số điện thoại (*):')
                    );
                    ?>
                    <div id = "txtcustomerphone" class="hidden" style="color: red">Vui long nhap so dien thoai</div>

                    <?php
                    echo $this->Form->input(
                        'customercompany',
                        array('label' => 'Tên Công Ty:')
                    );
                    ?>
                    <?php
                    echo $this->Form->input(
                        'customeraddress',
                        array('label' => 'Địa chỉ:')
                    );
                    ?>
                    <hr>
                    <p class="title-TTKH">Thông tin tour</p>
                    <?php
                    //            echo $this->Form->input(
                    //                'tourname',
                    //                array('label' => 'Tên tour')
                    //            );
                    echo $this->Form->input(
                        'startday',
                        array('label' => 'Ngày khởi hành:')
                    );
                    echo $this->Form->input(
                        'numofaldult',
                        array('label' => 'Số lượng Người lớn:')
                    );
                    echo $this->Form->input(
                        'numofchild',
                        array('label' => 'Số lượng Trẻ em:')
                    );
//                    echo $this->Form->input(
//                        'others',
//                        array('label' => 'Yêu cầu khác:',
//                            'style'=>'width:300px; height: 200px' )
//                    );

                    echo $this->Form->textarea (
                        'others',
                        array('label' => 'Yêu cầu khác:',
                            'style'=>'width:300px; height: 200px')
                    );

                    ?>
                    <?php
                    $options = array(
                        'label' => 'Submit',
                        'id' => 'submit',
                        'onclick' => 'return validate()'
                    );
                    echo $this->Form->end($options);
                    ?>
                </div>
            </div>

        </div>

    </div>



    <script>
        function validate(){
            var email = $('#PostCustomeremail').val();
            var name = $('#PostCustomername').val();
            var phone = $('#PostCustomerphone').val();
            var validate = true;
            if (!name){
                $( "#txtcustomername" ).removeClass( "hidden" );
                validate = false;
            }else{
                $( "#txtcustomername" ).addClass( "hidden" )
            }
            if (!phone){
                $( "#txtcustomerphone" ).removeClass( "hidden" );
                validate = false;
            }else{
                $( "#txtcustomerphone" ).addClass( "hidden" )
            }
            var re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
            if  (!re.test(email)){
                $( "#txtcustomeremail" ).removeClass( "hidden" );
                return false;
            }
            else
                $( "#txtcustomeremail" ).addClass( "hidden" );
        }
    </script>
</div>